<!--
* description: 索赔管理-索赔审核页面
* author: xuliwen
* createdDate: 2021-3-4
-->
<template>
  <section class="claimAudit">
    <el-dialog
      v-dialogDrag
      :visible.sync="curPopupsVisible"
      :title="titleName"
      width="70%"
      :append-to-body="true"
      :close-on-click-modal="false"
      @opened="openDialog"
      @close="closeEdit"
    >
      <dialogHeader
        slot="title"
        :title="titleName"
        :style-type="$store.state.app.dialogType"
      />

      <div class="btns-container">
        <el-button
          v-for="comp in tableButtons"
          :key="comp.compKey"
          :type="comp.type"
          :icon="comp.icon"
          :disabled="comp.disabled"
          @click="comp.clickEvent"
        >
          {{ comp.text }}
        </el-button>
      </div>
      <!-- 基本信息 -->
      <div class="filter-container filter-title">基本信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents1.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="true"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>
      <!-- 车辆信息 -->
      <div class="filter-container filter-title">车辆信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents2.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="true"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @clickEvent="receiveEvent(comp.clickEvent)"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>
      <!-- 客户信息 -->
      <div class="filter-container filter-title">客户信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1">
          <component
            :is="comp.component"
            v-for="comp in tableComponents3.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>
      <!-- 其他信息 -->
      <div class="filter-container filter-title">故障信息</div>
      <el-tabs v-model="activeName" style="background: #ffff">
        <!--<el-tab-pane label="故障信息" name="first">

        </el-tab-pane> -->
        <div class="filter-container filter-params">
          <el-row ref="vailComponentList1">
            <component
              :is="comp.component"
              v-for="comp in tableComponents4.filter((o) => o.isMust === true)"
              :ref="
                comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey
              "
              :key="comp.compKey"
              :validrule="comp.validrule"
              :code-field="comp.codeField"
              :text-field="comp.textField"
              :popups-key="comp.compKey"
              :parent-fileds="comp.parentFileds"
              :code="formField[comp.codeField]"
              :disabled="true"
              :o-fields="comp.oFields"
              :options="comp.options"
              :custom-obj="comp.customObj"
              :is-require="comp.isRequire"
              :is-mul="comp.isMul"
              :span="comp.span || 8"
              :label-name="comp.labelName"
              :lookuptype="comp.lookuptype"
              :data-to-object="comp.dataToObj"
              :date-options-type="comp.dateOptionsType"
              @changeCode="getComponentCode"
              @focusCode="getFocusCode"
            />
          </el-row>
        </div>

        <div class="filter-container filter-title">索赔工时</div>
        <OneTableTemplate
          ref="table_3_2"
          :dynamic-table-cols="tableHeader_4_3"
          :dynamic-table-defult-height="300"
          :dynamic-is-show-select="false"
          :is-show-pagination="false"
        />
        <div class="filter-container filter-title">索赔备件</div>
        <OneTableTemplate
          ref="table_3_3"
          :dynamic-table-cols="tableHeader_4_4"
          :dynamic-table-defult-height="300"
          :dynamic-is-show-select="false"
          :is-show-pagination="false"
          :callback-obj="callbackObj"
        />
        <div class="filter-container filter-title">索赔其他项目</div>
        <OneTableTemplate
          ref="table_3_4"
          :dynamic-table-cols="tableHeader_4_5"
          :dynamic-table-defult-height="300"
          :dynamic-is-show-select="false"
          :is-show-pagination="false"
        />
        <div class="filter-container filter-title">审核信息</div>
        <OneTableTemplate
          ref="table_3_5"
          :dynamic-table-cols="tableHeader_4_6"
          :dynamic-table-defult-height="300"
          :dynamic-is-show-select="false"
          :is-show-pagination="false"
        />
        <div class="filter-container filter-title">附件信息</div>
        <OneTableTemplate
          ref="table_3_1"
          :dynamic-table-cols="tableHeader_4_2"
          :dynamic-table-defult-height="300"
          :dynamic-is-show-select="false"
          :is-show-pagination="false"
        />

        <div class="filter-container filter-title">倒扣信息</div>
        <OneTableTemplate
          ref="table_3_6"
          :dynamic-components="tableHeader_4_7"
          :dynamic-table-defult-height="300"
          :dynamic-is-show-select="false"
          :is-show-pagination="false"
        />
        <div class="filter-container filter-title">申诉信息</div>
        <OneTableTemplate
          ref="table_3_7"
          :dynamic-table-cols="tableHeader_4_6"
          :dynamic-table-defult-height="300"
          :dynamic-is-show-select="false"
          :is-show-pagination="false"
        />
        <!-- <el-tab-pane label="附件信息" name="second">

        </el-tab-pane>
        <el-tab-pane label="索赔工时" name="three">

        </el-tab-pane>
        <el-tab-pane label="索赔备件" name="four">

        </el-tab-pane>
        <el-tab-pane label="索赔其他项目" name="five">

        </el-tab-pane>
        <el-tab-pane label="审核信息" name="six">

        </el-tab-pane>
        <el-tab-pane label="倒扣信息" name="seven">

        </el-tab-pane>
        <el-tab-pane label="申诉信息" name="eight">

        </el-tab-pane>-->
      </el-tabs>

      <auditEdit
        :key="inEditPopupsKey"
        :data-for-form="formField"
        :popups-visible="inEditPopupsVisible"
        :popups-state="inEditPopupsState"
        @closeInEdit="closeInEdit"
        @editSave="editSave"
      />
    </el-dialog>
  </section>
</template>

<script>
import OneTableTemplate from '@/components/templates/oneTable'
import dialogHeader from '@/components/dialogHeader'
import { oneTableWithViewTemplateMixins } from '@/components/mixins/oneTableWithViewTemplateMixins'
import { formMixins } from '@/components/mixins/formMixins'
import api from '@/api/se/apiClaimService'
import auditEdit from './auditEdit.vue'

export default {
  components: {
    dialogHeader,
    OneTableTemplate,
    auditEdit
  },

  mixins: [oneTableWithViewTemplateMixins, formMixins],

  props: {
    popupsVisible: {
      type: Boolean,
      default: false
    },
    dynamicEditRowData: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },
  data() {
    return {
      titleName: '索赔单审核',
      activeName: 'first',

      inEditPopupsKey: 'inEditPopupsKey',
      inEditPopupsState: '',
      inEditPopupsVisible: false,
      // inEditVisible:false,

      tableButtons: [
        {
          compKey: 'btnKey1',
          size: 'small',
          clickEvent: () => this.auditEdit('2'),
          text: '拒绝',
          position: 'right'
        },
        {
          compKey: 'btnKey2',
          size: 'small',
          clickEvent: () => this.auditEdit(),
          text: '退回',
          position: 'right'
        },
        {
          compKey: 'btnKey3',
          size: 'small',
          clickEvent: () => this.auditEdit('1'),
          text: '通过',
          position: 'right'
        }
      ],
      tableComponents1: [
        {
          compKey: 'key0',
          labelName: '门店编码：',
          codeField: 'dlrCode',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key1',
          labelName: '门店名称：',
          codeField: 'dlrFullName',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key2',
          labelName: '索赔单号：',
          codeField: 'claimCode',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key3',
          labelName: '单据状态：',
          codeField: 'claimStatus',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key4',
          labelName: '索赔员：',
          codeField: 'claimEmpNO',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key5',
          labelName: '索赔员电话：',
          codeField: 'linkManTel',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key6',
          labelName: '索赔分类：',
          codeField: 'claimTypeName',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          isRequire: true,
          disabled: true
        },
        {
          compKey: 'key7',
          labelName: '活动编号：',
          codeField: 'actionCode',
          component: () => import('@/components/org/LookupValue'),
          oFields: 'statusId,statusText',
          options: [
            { statusId: '1', statusText: '文章1' },
            { statusId: '0', statusText: '文章' }
          ],
          type: 'dropdownList',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key8',
          labelName: '索赔月份：',
          codeField: 'claimMonth',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key9',
          labelName: '提交日期：',
          codeField: 'submitDate',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key12',
          labelName: '工时费：',
          codeField: 'wiAmount',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key13',
          labelName: '备件费：',
          codeField: 'partAmount',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key14',
          labelName: '其他费用：',
          codeField: 'otherAmount',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key15',
          labelName: '总金额：',
          codeField: 'sumAmount',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key16',
          labelName: '同意单号：',
          codeField: 'agreeNO',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
          // disabled: true
        }
      ],
      tableComponents2: [
        {
          compKey: 'key0',
          labelName: '派工单号：',
          codeField: 'repairOrderCode',
          isMul: false,
          component: () => import('@/components/se/sparePartNameCode'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key1',
          labelName: '车牌号：',
          codeField: 'carLicense',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key2',
          labelName: '车型：',
          codeField: 'carConfigCN',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key3',
          labelName: '进厂时间：',
          codeField: 'repairDate',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key4',
          labelName: '保修开始日期：',
          codeField: 'invoiceDate',
          isMul: false,
          component: () => import('@/components/org/datePicker/datePicker.vue'),
          type: 'datePicker',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key5',
          labelName: '行驶里程：',
          codeField: 'mileage',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key6',
          labelName: '购件里程：',
          codeField: 'payMileage',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key7',
          labelName: '购件日期：',
          codeField: 'payDate',
          isMul: false,
          component: () => import('@/components/org/datePicker/datePicker.vue'),
          type: 'datePicker',
          isMust: true
        },
        {
          compKey: 'key8',
          labelName: '保修申请单号：',
          codeField: 'preAuthorCode',
          clickEvent: () => this.goClaimApplication(),
          component: () => import('@/components/org/commonInput/indexLink.vue'),
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key9',
          labelName: 'VIN码：',
          codeField: 'VIN',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key11',
          labelName: '车辆用途：',
          codeField: 'buyCaruseCodeName',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key12',
          labelName: '生产日期：',
          codeField: 'produceDate',
          isMul: false,
          component: () => import('@/components/org/datePicker/datePicker.vue'),
          type: 'datePicker',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key13',
          labelName: '前电机号：',
          codeField: 'engineCode',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key14',
          labelName: '后电机号：',
          codeField: 'engineCode2',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key15',
          labelName: '底盘号：',
          codeField: 'underpanNO',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key16',
          labelName: '变速箱号：',
          codeField: 'ectCode',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        }
      ],
      tableComponents3: [
        {
          compKey: 'key0',
          labelName: '车主姓名：',
          codeField: 'custName',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key1',
          labelName: '性别：',
          codeField: 'gender',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key2',
          labelName: '车主手机：',
          codeField: 'phone',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key3',
          labelName: '省份：',
          codeField: 'addrPrivince',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key4',
          labelName: '城市：',
          codeField: 'addrCity',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key5',
          labelName: '区县：',
          codeField: 'addrCounty',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key6',
          labelName: '街道地址：',
          codeField: 'addrStreet',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key7',
          labelName: '送修人：',
          codeField: 'linkMan',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key8',
          labelName: '送修人电话：',
          codeField: 'linkManTels',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        }
      ],
      tableComponents4: [
        {
          compKey: 'key0',
          labelName: '故障类型：',
          codeField: 'custType',
          textField: 'custTypeName',
          customObj: {
            api: api.findCustType,
            selectType: '1',
            defOptionFields: ['custType', 'custTypeName']
          },
          component: () => import('@/components/org/commonSelect'),
          type: 'dropdownList',
          isMust: true
        },

        {
          compKey: 'key2',
          labelName: '主损件名称：',
          codeField: 'mainFaultName',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key1',
          labelName: '主损件编码：',
          codeField: 'mainFaultCode',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true
        },
        {
          compKey: 'key3',
          labelName: '故障日期：',
          codeField: 'faultDate',
          isMul: false,
          component: () => import('@/components/org/datePicker/datePicker.vue'),
          type: 'datePicker',
          isMust: true,
          isRequire: true
        },
        {
          compKey: 'key4',
          labelName: '故障现象码：',
          codeField: 'csCode',
          oFields: 'csCtCode,csCtName',
          customObj: {
            api: api.findFaultPhenomenon,
            selectType: '1'
          },
          component: () => import('@/components/org/commonSelect'),
          type: 'dropdownList',
          isMust: true
        },
        {
          compKey: 'key6',
          labelName: '故障部位：',
          codeField: 'faultPartCode',
          textField: 'faultPartName',
          oFields: 'faultPartCode,faultPartName',
          customObj: {
            api: api.findFaultPartName,
            selectType: '1'
          },
          component: () => import('@/components/org/commonSelect'),
          type: 'dropdownList',
          isMust: true
        },
        {
          compKey: 'key9',
          labelName: '故障描述：',
          codeField: 'custComplainCS',
          component: () => import('@/components/org/commonInput/textareaInput'),
          type: 'dropdownList',
          isRequire: true,
          isMust: true,
          span: 24
        },
        {
          compKey: 'key10',
          labelName: '诊断过程：',
          codeField: 'detailCheckSynopsis',
          component: () => import('@/components/org/commonInput/textareaInput'),
          type: 'dropdownList',
          isMust: true,
          isRequire: true,
          span: 24
        },
        {
          compKey: 'key11',
          labelName: '故障处理：',
          codeField: 'repairWay',
          component: () => import('@/components/org/commonInput/textareaInput'),
          type: 'dropdownList',
          isRequire: true,
          isMust: true,
          span: 24
        }
      ],

      tableHeader_4_2: [
        {
          prop: 'controlBtn',
          label: '操作',
          codeField: 'controlBtn',
          width: 100,
          align: 'center',
          fixed: true,
          isComponent: true,
          comps: [
            {
              compKey: 'propKey1',
              align: 'center',
              labelName: '下载',
              component: () => import('@/components/org/linkButton'),
              clickEvent: (index) => this.fileDownload(index)
            }
          ]
        },
        {
          label: '附件名称',
          prop: 'fileName'
        },
        {
          label: '附件路径',
          prop: 'attachmentFilePath',
          hidden: true,
          alwaysHidden: true
        },
        {
          label: '备注',
          prop: 'fileRemark'
        }
      ],
      tableHeader_4_3: [
        {
          label: '工时编码',
          prop: 'wiCode'
        },
        {
          label: '维修内容',
          prop: 'wiName'
        },
        {
          label: '工时数',
          prop: 'wiQty'
        },
        {
          label: '工时单价',
          prop: 'wiPrice'
        },
        {
          label: '索赔系数',
          prop: 'claimWiCoef'
        },
        {
          label: '费用合计',
          prop: 'wiTotal'
        }
      ],
      tableHeader_4_4: [
        {
          label: '备件编码',
          prop: 'partNo'
        },
        {
          label: '备件名称',
          prop: 'partName'
        },
        {
          label: '数量',
          prop: 'partQty'
        },
        {
          label: '单价',
          prop: 'partPrice'
        },
        {
          label: '索赔系数',
          prop: 'claimPartCoef'
        },
        {
          label: '费用合计',
          prop: 'partTotal'
        }
      ],
      tableHeader_4_5: [
        {
          label: '其他项目No',
          prop: 'otherFeeId',
          hidden: true,
          alwaysHidden: true
        },
        {
          label: '其他项目',
          prop: 'otherFeeName'
        },
        {
          label: '费用',
          prop: 'otherFee'
        },
        {
          label: '备注',
          prop: 'otherRemark'
        }
      ],
      tableHeader_4_6: [
        {
          label: '保修鉴定申诉ID',
          prop: 'appealID',
          hidden: true,
          alwaysHidden: true
        },
        {
          label: '审核状态',
          prop: 'claimStatus'
        },
        {
          label: '审核意见',
          prop: 'checkInfo'
        },
        {
          label: '审核人',
          prop: 'checkMan'
        },
        {
          label: '审核时间',
          prop: 'checkTime'
        },
        {
          label: '备注',
          prop: 'checkRemark'
        }
      ],
      tableHeader_4_7: [
        {
          compKey: 'key0',
          labelName: '倒扣单号：',
          codeField: 'reverseCode',
          component: () => import('@/components/org/LookupValue'),
          type: 'dropdownList',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key1',
          labelName: '倒扣状态：',
          codeField: 'reverseStatus',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key2',
          labelName: '已扣金额：',
          codeField: 'buckledAmount',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key3',
          labelName: '待扣金额：',
          codeField: 'yetAmount',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        {
          compKey: 'key4',
          labelName: '倒扣金额：',
          codeField: 'reverseAmount',
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        },
        // claimId  保修鉴定单ID
        {
          compKey: 'key5',
          labelName: '倒扣原因：',
          codeField: 'reason',
          span: 18,
          isMul: false,
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          isMust: true,
          disabled: true
        }
      ],
      formField: {
        claimEmpNO: '', // 索赔员
        dlrCode: '',
        dlrFullName: '',
        claimStatus: '',
        empName: '',
        workTel: '',
        claimType: '',
        claimCode: '',
        actionCode: '',
        claimMonth: '',
        submitDate: '',
        shipAmount: '',
        compAmount: '',
        wiAmount: '',
        partAmount: '',
        otherAmount: '0',
        sumAmount: '0',
        repairOrderCode: '',
        carLicense: '',
        carConfigCN: '',
        repairDate: '',
        invoiceDate: '',
        mileage: '',
        payMileage: '',
        payDate: '',
        preAuthorCode: '',
        VIN: '',
        buyCaruseCodeName: '',
        produceDate: '',
        engineCode: '',
        engineCode2: '',
        underpanNO: '',
        ectCode: '',
        gender: '',
        phone: '',
        addrPrivince: '',
        addrCity: '',
        addrCounty: '',
        addrStreet: '',
        linkMan: '',
        linkManTels: '',
        custType: '',
        partNo: '',
        partName: '',
        faultDate: '',
        csCode: '',
        faultDTC: '',
        remark: '',
        custComplainCS: '',
        detailCheckSynopsis: '',
        repairWay: '',
        faultPartCode: '',
        agreeNO: ''
      },

      callbackObj: {
        onCheckSelectChange: (selection) => {
          this.selectTable = selection
        }
      }
    }
  },

  methods: {
    // 下载附件
    fileDownload(index) {
      if (this.$refs['table_3_1'].list[index].attachmentFilePath) {
        this.$utils.FileDownload([
          this.$refs['table_3_1'].list[index].attachmentFilePath
        ])
      }
    },

    auditEdit(type) {
      if (type === '1') {
        this.formField.claimStatusName = '25'
      } else if (type === '2') {
        this.formField.claimStatusName = '-10'
      } else {
        this.formField.claimStatusName = '5'
      }

      this.inEditPopupsVisible = true
    },
    editSave(checkInfo) {
      this.formField = Object.assign(this.formField, checkInfo)
      this.$requestAPI({
        apiUrl: api.claimAndAppealReview.APIUrl,
        variables: {
          claimStatus: this.formField.claimStatusName,
          claimID: this.formField.claimID,
          checkInfo: this.formField.checkInfo
        }
      }).then((res) => {
        if (res.result === '1') {
          this.$message.success(res.msg)
          this.closeInEdit()
          this.closeEdit()
        } else {
          this.$message.warning(res.msg)
        }
      })
    },
    openDialog() {
      this.findClaimDetail()
    },

    findClaimDetail() {
      const queryObj = {
        // 保存mutation
        type: 'query',
        // api配置
        apiConfig: api.findClaimDetail,
        // 条件/实体参数（变量），根据typeParam中的定义配置
        variables: {
          claimCode: this.dynamicEditRowData.claimCode
        }
      }
      // 转换了中台请求格式数据
      var paramD = this.$getParams(queryObj)
      // 调用中台API方法（可复用）
      this.$requestAPI(paramD).then((res) => {
        if (res.result === '1') {
          this.formField = res.rows[0]
          this.formField.fujianInfo = res.rows[0].fujianInfo
          this.$refs['table_3_1'].list = this.formField.fujianInfo
          this.$refs['table_3_2'].list = this.formField.workingHoursInfo
          this.$refs['table_3_3'].list = this.formField.sparePartInfo
          this.$refs['table_3_4'].list = this.formField.otherInfo
          this.$refs['table_3_5'].list = this.formField.claimInfo
        }
      })
    },
    // 关闭弹窗
    closeEdit() {
      this.$emit('update:popupsVisible', false)
      this.$parent.queryTable()
      this.reset()
    },
    // 关闭审核意见
    closeInEdit() {
      this.inEditPopupsVisible = false
      this.inEditPopupsKey = this.$utils.generateId()
    }
  }
}
</script>

<style lang='scss' scoped>
.btns-container {
  width: 100%;
  height: 30px;
  padding: 0 20px;
  background-color: #fff;
  .el-button {
    float: right;
    margin-left: 10px;
  }
}

/deep/#UE-e3s {
  height: auto;
}
/deep/.el-table {
  height: auto !important;
  min-height: 30px;
}
/deep/.el-table__empty-block {
  height: auto;
  min-height: 25px;
}
/deep/ .el-table__body-wrapper {
  height: auto !important;
  min-height: 25px;
}
/deep/.el-table__empty-text {
  display: none;
}
</style>

